package _07错误票据;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class _07_错误票据1 {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        ArrayList<Integer> list = new ArrayList<>();
        in.next();//n没什么用
        while (in.hasNext()) {
            int x = in.nextInt();
            if (x == -1)//仅仅方便自己检查，没用
                break;
            list.add(x);
        }
        int x = 0, y = 0;
        Collections.sort(list);
        for (int i = 0; i < list.size() - 1; i++) {
            if (list.get(i).equals(list.get(i + 1))) {
                y = list.get(i);
                list.remove(i);
                break;
            }
        }
        int start = list.get(0);
        for (int i : list) {
            if (start != i) {
                System.out.println(start + " " + y);
                break;
            } else
                start++;
        }

    }
}